package com.lanou.projecta;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.widget.Toast;

/**
 * Created by dllo on 16/1/23.
 */
public class WebViewActivity extends AppCompatActivity{
    private WebView webView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        webView = new WebView(this);

        webView.getSettings().setJavaScriptEnabled(true);


        Intent intent = getIntent();
        String s = intent.getStringExtra("webView");

        webView.loadUrl(s);

        setContentView(webView);

    }

//    @Override
//    public boolean onKeyDown(int keyCode, KeyEvent event) {
//        if((keyCode==KeyEvent.KEYCODE_BACK)&&webView.canGoBack()){
//            webView.canGoBack();
//            Toast.makeText(WebViewActivity.this, "hh", Toast.LENGTH_SHORT).show();
//            return true;
//
//        }
//        return false;
//    }
}
